package acwing._1_1AlgorithmBasic._4Math;
/**
 * @Project : AlgorithmLearning
 * @Package : ACWing._1_1AlgorithmBasic._4Math
 * @File : Q0890.java
 * @Author : WangRuoyu
 * @Date : 2023/4/5 15:22
 */

import java.io.*;

public class Q0890 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] words = br.readLine().split(" ");
        int n = Integer.parseInt(words[0]);
        int res = 0;
        int pm = Integer.parseInt(words[1]);
        int[] p = new int[pm];

        words = br.readLine().split(" ");
        for (int i = 0; i < pm; ++i) {
            p[i] = Integer.parseInt(words[i]);
        }

        for1:
        for (int i = 1; i < 1 << pm; ++i) {
            long pn = 1;
            int cnt = -1;

            for (int j = 0; j < pm; ++j) {
                if ((i >> j & 1) == 1) {
                    pn *= p[j];
                    cnt = -cnt;
                    if (pn > n) {
                        continue for1;
                    }
                }
            }
            res += cnt * (n / pn);
        }

        wr.write(res + "\n");
        wr.flush();
    }
}